package day03;

public class BasicPractice {
    public static void main(String[] args) {
        double price=1500.0;//2500.0 800.0 -10.0
        if(price>=2000){
            price*=0.5;
        }else if(price>=1000){
            price*=0.7;
        }else if(price>=500){
            price*=0.8;
        }else if(price>=0){
            price*=0.9;
        }else{
            System.out.println("Error");
        }
        System.out.println(price);//1050.0 1250.0 640.0 Error-10.0




        /*if else 二选一
        double price=300.0;//  700.0
        if(price>=500){
            price*=0.8;
        }else{
            price*=0.9;
        }
        System.out.println(price);//270.0  560.0

        int score=98;//150  -56
        if(score>=0&&score<=100){
            System.out.println("成绩合法");
        }else{
            System.out.println("成绩不合法");
        }

         */




        /*if型
        double price=688.0;
        if(price>=500){
            price*=0.8;
        }
        System.out.println(price);//688*0.8

        int score=18;
        if(score>=0&&score<=100){
            System.out.println("成绩合法");
        }
        System.out.println("继续使用");



         */




        /*条件运算
        int num=3;
        int flag=num>4?1:0;
        System.out.println(flag);//0
        int a=4,b=8;
        int max=a>b?a:b;//比较两个数取最大值
        System.out.println(max);//8


         */




        /*字符串连接
        int age=20;
        String name="蔡徐坤";
        System.out.println("我叫"+name+"，我今年"+age+"岁了");
        //我叫蔡徐坤，我今年20岁了

        System.out.println(10+20+30+"");//60-----string
        System.out.println(10+20+""+30);//3030----string
        System.out.println(""+10+20+30);//102030---string
        //任何类型与字符串型连接就会被同化为字符串型




         */



        /*赋值
        int a=2;
        a+=10;//12
        a*=2;//24
        a/=4;//6
        a&=5;//1
        //面试小题目
        short s=5;
        //s=s+10;需要强转s=(short)(s+10);
        s+=10;//自动进行强转，相当于s=(short)(s+10);


         */



        /*逻辑
        int a=5,b=10,c=5;
        boolean a1=a<b&&a>c;
        System.out.println(a1);//true&&false=false
        System.out.println(a>b||b>c);//false||true=true
        System.out.println(!(a>b));//!false=true

        System.out.println(a>b&&c++>4);//false
        System.out.println(c);//5 发生短路不执行c++
        System.out.println(a<b||c++>4);//true
        System.out.println(c);//5发生短路不执行c++



        /*关系运算符
        int a=1,b=2,c=4;
        boolean a1=a>b;
        System.out.println(a1);//false
        System.out.println(a<=b);//true
        System.out.println(a==c);//false
        System.out.println(a!=b);//true

         */







        /*算数运算符

        int a=3,b=2;
        System.out.println(a%b);//1
        a++;//单独用a++=a+1
        ++b;//++b=b+1
        int c=a++;//被使用 a++=a，但会自增1
        int d=++b;//被使用 ++b=b+1，但会自增1
        System.out.println(a);//5
        System.out.println(b);//4
        System.out.println(c);//4
        System.out.println(d);//4


         */

    }
}
